<template>
	<view class="bgw">
		<view class="u-p-28 u-font-32 u-border-bottom" style="font-weight: bold;">
			{{detail.title}}
		</view>
		<view class="u-p-28">
			<!-- <view class="ql-container">
				<rich-text class="ql-editor" :nodes="detail.content"></rich-text>
			</view> -->
			<view v-html="detail.content" class="ql-container"/>
			
		</view>
	</view>

</template>
<script setup>
	import store from '@/store/index.js';
	import formatRichText from '@/common/js/richText.js';
	import {
		ref,
		reactive,
		computed,
		getCurrentInstance
	} from 'vue'
	import {
		onReady,
		onLoad,
		onShow
	} from '@dcloudio/uni-app'
	const {
		proxy,
	} = getCurrentInstance()
	const {
		baseImgUrl
	} = proxy;
	const {
		nav,
		navLogin,
		htmlAddImgUrl
	} = proxy.$util;
	const props = defineProps({
		sid: {
			type: [String, Number],
			default: '',
		},
		type: {
			type: [String, Number],
			default: '',
		},

	})
	const detail = reactive({});
	const getData = () => {
		if (props.type) {
			uni.showLoading({
				title: '加载中'
			});
			proxy.$u.api.getContentInfo(props.type).then(res => {
				let {
					data,
					code,
					msg
				} = res;
				if (code == 200) {
					if(data.content){
						data.content = htmlAddImgUrl(data.content,baseImgUrl)
						data.content = formatRichText(data.content)
					}
					for (let key in data) {
						detail[key] = data[key]
					}
					
					uni.setNavigationBarTitle({
						title: data.title
					});
				} else {
					uni.$u.toast(msg || '错误');
				}
			}).catch(e => {

			}).finally(e => {

			})
		}
	}
	onLoad((d) => {
		getData()
	})
</script>

<style lang="scss" scoped>

</style>